/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author freis
 */
@Entity
@Table(name = "contextos")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Contextos.findAll", query = "SELECT c FROM Contextos c"),
    @NamedQuery(name = "Contextos.findByIdContextos", query = "SELECT c FROM Contextos c WHERE c.idContextos = :idContextos"),
    @NamedQuery(name = "Contextos.findByNome", query = "SELECT c FROM Contextos c WHERE c.nome = :nome"),
    @NamedQuery(name = "Contextos.findByDescricaoContexto", query = "SELECT c FROM Contextos c WHERE c.descricaoContexto = :descricaoContexto")})
public class Contextos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idContextos")
    private Integer idContextos;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "nome")
    private String nome;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 300)
    @Column(name = "descricaoContexto")
    private String descricaoContexto;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "contextosidContextos")
    private Collection<Accoes> accoesCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "contextosidContextos")
    private Collection<Actividades> actividadesCollection;

    public Contextos() {
    }

    public Contextos(Integer idContextos) {
        this.idContextos = idContextos;
    }

    public Contextos(Integer idContextos, String nome, String descricaoContexto) {
        this.idContextos = idContextos;
        this.nome = nome;
        this.descricaoContexto = descricaoContexto;
    }

    public Integer getIdContextos() {
        return idContextos;
    }

    public void setIdContextos(Integer idContextos) {
        this.idContextos = idContextos;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getDescricaoContexto() {
        return descricaoContexto;
    }

    public void setDescricaoContexto(String descricaoContexto) {
        this.descricaoContexto = descricaoContexto;
    }

    @XmlTransient
    public Collection<Accoes> getAccoesCollection() {
        return accoesCollection;
    }

    public void setAccoesCollection(Collection<Accoes> accoesCollection) {
        this.accoesCollection = accoesCollection;
    }

    @XmlTransient
    public Collection<Actividades> getActividadesCollection() {
        return actividadesCollection;
    }

    public void setActividadesCollection(Collection<Actividades> actividadesCollection) {
        this.actividadesCollection = actividadesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idContextos != null ? idContextos.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Contextos)) {
            return false;
        }
        Contextos other = (Contextos) object;
        if ((this.idContextos == null && other.idContextos != null) || (this.idContextos != null && !this.idContextos.equals(other.idContextos))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Contextos[ idContextos=" + idContextos + " ]";
    }
    
}
